<?php

Yii::import('application.models._base.BaseAutobid');


class Autobid extends BaseAutobid
{
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
	
	/**
	 * 在autobid列表中获取详细的URL列表
	 */
	static public function getDetailUrl($data){
	    $auctionInfo=new AuctionInfo();
	    $auctionInfo=$auctionInfo->findByPk($data->auction_id);
	    return CHtml::link(
	        $auctionInfo->title,
	        Yii::app()->params['site_url']."/auction-".AuctionInfo::urlencode($auctionInfo->title)."-".$data->auction_id,
	        array(
	            'target'=>'_blank'
	        )
	    );
	}
	
    public function search(){
    		$criteria = new CDbCriteria;
    		return  $a=new CActiveDataProvider($this, array(
    				'criteria' => $criteria,
    				'pagination'=>array(
    						'pageSize'=>25, //当前页数显示记录条数
    				),
    		));
	}
	
	public function search_myaccount(){
    		$criteria = new CDbCriteria;
			$criteria->addCondition('customer_id='.yii::app()->user->id);
			$criteria->order="t.created desc";
    		return  $a=new CActiveDataProvider($this, array(
    				'criteria' => $criteria,
    				'pagination'=>array(
    						'pageSize'=>25, //当前页数显示记录条数
    				),
    		));
	}
}